package com.project.study.farming.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 初始化类
 * @since 2020-04-07
        */
@Configuration
public class ExceutorConfig {

    @Bean("pool")
    public Object getThreadPool(){
        return new ThreadPoolExecutor(20, 200, 3,  TimeUnit.MINUTES,
                new ArrayBlockingQueue<>(1000), Thread :: new, new ThreadPoolExecutor.AbortPolicy());
    }
}
